package com.bwie.controller;

import com.bwie.pojo.User;
import com.bwie.service.impl.TbUserServiceImpl;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/feign")
public class TestOpenFeign {

    @Autowired
    TbUserServiceImpl tbUserService;

    @PostMapping("/feigntest")
    public String feigntest(){
        return "openfeign调用成功";
    }

    /**
     * mybatis-plus逻辑删除使用
     */
    @PostMapping
    public String delete(){
        tbUserService.removeById(1);
        return "删除";
    }

    /**
     * 调用
     */
    @PostMapping("/sdfsdf")
    public R select(){
        List<User> list = tbUserService.list();
        return R.OK(list);
    }
}
